package com.taomus.mytools.simplec;

import java.util.LinkedList;

import com.taomus.mytools.simplec.common.Token;
import com.taomus.mytools.simplec.common.Word;
import com.taomus.mytools.simplec.common.WordEnum;

public class Syntax {
	private LinkedList<Token> tkList = new LinkedList<>();
	public synchronized void analyse(String text) {
		int line = 1;
		Lex lex = new Lex(text.toCharArray());
		while (true) {
			Token tk = lex.getToken();
			tk.setLine(line);
			if (tk == Word.TK_EOF) {
				tkList.add(tk);
				break;
			}
			if (tk.getCode() == WordEnum.ROW){
				line += 1;
				continue;
			}
			tkList.add(tk);
		}
		Analyse2 aly = new Analyse2(tkList);
		aly.begin();
	}
}